    //
//  MenuViewController.m
//  FastPdfKit
//
//  Created by 刘刚 9/20/17.
//  Copyright 2010 刘刚 All rights reserved.
//

#import "MenuViewController.h"
#import <FastPdfKit/FastPdfKit.h>
#import "OverlayManager.h"

#include <stdio.h>
#include <stdlib.h>

#define TEXT_PLAIN @"web学习.PDF"
#define TEXT_ENCRYPTED @""

#define TITLE_PLAIN @"打开"
#define TITLE_ENCRYPTED @"打开"

#define DOC_PLAIN @"web学习"
#define DOC_ENCRYPTED @"Manual"

#define TAG_ALERTVIEW 1
#define TAG_PASSWORDFIELD 2

@implementation MenuViewController

#pragma mark - Plain document

-(IBAction)actionOpenPlainDocument:(id)sender
{
    NSString *filePath = [[NSBundle mainBundle]pathForResource:DOC_PLAIN ofType:@"pdf"];
	NSURL *documentUrl = [NSURL fileURLWithPath:filePath];

	MFDocumentManager *aDocManager = [[MFDocumentManager alloc]initWithFileUrl:documentUrl];
    
    //pdf内容控制器
    ReaderViewController * readerViewController = [[ReaderViewController alloc]initWithDocumentManager:aDocManager];
    readerViewController.edgesForExtendedLayout = UIRectEdgeNone;
	[readerViewController setDocumentId:DOC_PLAIN];
	[readerViewController setDocumentDelegate:readerViewController];
    NSString *titleText = [NSString stringWithFormat:@"%@.pdf",DOC_PLAIN];
    readerViewController.titleText = titleText;
    OverlayManager *ovManager = [[OverlayManager alloc] init];
    [readerViewController addOverlayDataSource:ovManager];
	
    [self presentViewController:readerViewController animated:YES completion:nil];
}


#pragma mark - UIViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

		UIFont *smallSystemFont = [UIFont systemFontOfSize:[UIFont smallSystemFontSize]];
		
		[self.referenceTextView setText:TEXT_PLAIN];
		[self.referenceTextView setFont:[UIFont systemFontOfSize:20]];
		
		[self.referenceButton setTitle:TITLE_PLAIN forState:UIControlStateNormal];
}

-(BOOL)shouldAutorotate {
    return YES;
}

-(UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
	return YES;
}

@end
